package uselessmouths.listenerservice.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import uselessmouths.mainservices.service.TerminalsService;

@Controller
@RequestMapping("/hello")
public class TerminalsPageController extends AbstractController {

    TerminalsService terminalsService = TerminalsService.getInstance();
    
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {

        ModelAndView model = new ModelAndView("index");
        model.addObject("terminals", terminalsService.getAllTerminals());

        return model;
    }
}
